package com.news.model;

/**
 * 新闻来源枚举
 */
public enum NewsSource {
    BILIBILI("哔哩哔哩", "https://www.bilibili.com", "bilibili"),
    WEIBO("微博", "https://weibo.com", "weibo"),
    BAIDU("百度", "https://www.baidu.com", "baidu"),
    ZHIHU("知乎", "https://www.zhihu.com", "zhihu"),
    TOUTIAO("今日头条", "https://www.toutiao.com", "toutiao");

    private final String displayName;
    private final String baseUrl;
    private final String sourceId;

    NewsSource(String displayName, String baseUrl, String sourceId) {
        this.displayName = displayName;
        this.baseUrl = baseUrl;
        this.sourceId = sourceId;
    }

    public String getDisplayName() {
        return displayName;
    }

    public String getBaseUrl() {
        return baseUrl;
    }

    public String getSourceId() {
        return sourceId;
    }

    public static NewsSource fromSourceId(String sourceId) {
        for (NewsSource source : values()) {
            if (source.sourceId.equals(sourceId)) {
                return source;
            }
        }
        throw new IllegalArgumentException("Unknown source ID: " + sourceId);
    }
} 